package 机试题16年;

import java.text.DecimalFormat;
import java.util.Scanner;

/**
 * Created by hest0 on 2017/4/19.
 */
public class 礼物 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int[] c = new int[m];
            for (int i = 0; i < m; i++) {
                c[i] = sc.nextInt();
            }
            double[][] p = new double[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    p[i][j] = sc.nextDouble();
                }
            }
            System.out.println(parent(n, m, c, p));
        }
        sc.close();
    }

    private static String parent(int n, int m, int[] c, double[][] p) {

        double[][][] dp = new double[n + 1][m + 1][n + 1];
        for (int j = 0; j < m; j++) {
            dp[0][j + 1][c[j]] = 1;
        }
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                dp[i][j][0] += dp[i - 1][j][0];
                for (int k = 1; k <= n; k++) {
                    if (dp[i - 1][j][k] != 0) {
                        dp[i][j][k] += dp[i - 1][j][k] * (1 - p[i - 1][j - 1]);
                        dp[i][j][k - 1] += dp[i - 1][j][k] * (p[i - 1][j - 1]);
                    }
                }
            }
        }
        double[][] pro = dp[n];
        double res = 0;
        for (int i = 1; i <= m; i++) {
            for (int j = 0; j <= c[i - 1]; j++) {
                if (pro[i][j] != 0)
                    res += pro[i][j] * (c[i - 1] - j);
            }
        }

        return new DecimalFormat("0.0").format(res);
    }

}
